package com.itheima.demo5;

import javafx.beans.property.Property;

import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Demo {
    public static void main(String[] args) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {

        BufferedReader bufferedReader = new BufferedReader(new FileReader("jdbc.properties"));
        Properties property = new Properties();

        property.load(bufferedReader);
        bufferedReader.close();
        String className = property.getProperty("className");
        String methodName = property.getProperty("methodName");


        Class aClass = Class.forName(className);
        Object o = aClass.newInstance();
        Method declaredMethod = aClass.getDeclaredMethod(methodName);
        declaredMethod.setAccessible(true);
        declaredMethod.invoke(o);
    }
}
